package cn.scu.ne04jdemo.controller;

import cn.scu.ne04jdemo.entitiy.ScheDevInfoEntity;
import cn.scu.ne04jdemo.entitiy.ScheDevTypeInfoEntity;
import cn.scu.ne04jdemo.entitiy.ScheOrderTaskInfoEntity;
import cn.scu.ne04jdemo.service.ScheOrderTaskInfoService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/sche/order/task/info")
public class ScheOrderTaskInfoController {

    @Autowired
    private ScheOrderTaskInfoService scheOrderTaskInfoService;

    @GetMapping("/findPage")
    public ResponseEntity<IPage> findPage(@RequestParam(required = false) String orderId, @RequestParam(required = false) String orderName, @RequestParam(required = false) String taskState
            , @RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "10") int pageSize) {
        IPage<ScheOrderTaskInfoEntity> page = null;
        try {
            page = scheOrderTaskInfoService.findPage(new Page<>(pageNum, pageSize), orderId, orderName, taskState);
        }catch (Exception e){
            e.printStackTrace();
        }
        return ResponseEntity.ok(page);
    }

}
